#include<bits/stdc++.h>
using namespace std;
const int MAX = 1e5;
int N,M;
int a[MAX];
int check(int x)
{
	int ret = 1;
	for(int i = 1,last = 0;i<N;i++)
	{
		if(a[i] - a[last]>=x)
		{
			ret++;
			last = i;
		}
	}
	return ret;
}
int main()
{
	cin>>N>>M;
	for(int i = 0;i<N;i++)
	cin>>a[i];
	sort(a,&a[N-1]);
	int ans = 0;
	int L = 0,R = 1e9+1;
	while(L<=R)
	{
		int mid = (L+R)/2;
		if(check(mid)>=M)
		{
			ans = mid;
			L = mid+1;
		}
		else
		{
			
			R = mid - 1;
		}
	}
	cout<<ans;
	return 0;
}
